package com.tmsps.ne4Weixin.api.entity.menu;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.annotation.JSONField;
import com.tmsps.ne4Weixin.api.entity.BaseModel;

public class Menu extends BaseModel {
	// 一级菜单最多三个
	@JSONField(name = "button")
	private List<MenuButton> menuButton = new ArrayList<MenuButton>();

	public List<MenuButton> getMenuButton() {
		return menuButton;
	}

	public void setMenuButton(List<MenuButton> menuButton) {
		if (null == menuButton || menuButton.size() > 3) {
			throw new IllegalArgumentException("一级菜单最多只有3个");
		}
		this.menuButton = menuButton;
	}

	public void addMenuButton(MenuButton mb) {
		this.menuButton.add(mb);
		if (this.menuButton.size() > 3) {
			throw new IllegalArgumentException("一级菜单最多只有3个");
		}
	}
}
